package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppAssetHoldings;
import com.ep.modules.app.service.AppAssetHoldingsService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/asset_holdings")
public class AppAssetHoldingsController {
    @Autowired
    private AppAssetHoldingsService appAssetHoldingsService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appAssetHoldingsService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppAssetHoldings appassetholdings = appAssetHoldingsService.getById(id);
        return R.ok().put("appassetholdings", appassetholdings);
    }

    @SysLog("保存AppAssetHoldings")
    @PostMapping("/save")
    public R save(@RequestBody AppAssetHoldings appassetholdings) {
        ValidatorUtils.validateEntity(appassetholdings);
        appAssetHoldingsService.save(appassetholdings);
        return R.ok();
    }

    @SysLog("修改AppAssetHoldings")
    @PostMapping("/update")
    public R update(@RequestBody AppAssetHoldings appassetholdings) {
        ValidatorUtils.validateEntity(appassetholdings);
        appAssetHoldingsService.update(appassetholdings);
        return R.ok();
    }

    @SysLog("删除AppAssetHoldings")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appAssetHoldingsService.deleteBatch(ids);
        return R.ok();
    }
}